<template>
  <div class="hello">
    <el-table :data="msg" style="width: 100%">
      <el-table-column prop="userName" label="登录名称" width="180"></el-table-column>
      <el-table-column prop="realName" label="真实姓名" width="180"></el-table-column>
      <el-table-column prop="userType" label="用户类型"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button @click="getIdClick(scope.$index, scope.row)">修改</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-button @click="submitClick">查询用户信息</el-button>

  </div>
</template>

<script>
  export default {
    name: 'HelloWorld',
    mounted: function() {
      //这是注释
      //this.submitClick();
    },
    data() {
      return {
        msg: []
      }
    },
    methods: {
      submitClick() {
        this.$axios.get("/neusys/user/queryAllUser")
          .then(response => {
            this.msg = response.data;
          })
      },
      getIdClick(index, row) {
        this.$axios.get("/neusys/user/toupdate", {
            params: {
              id: this.msg[index].id,
            }
          })
          .then(response => {
            alert("ok");
          })
      }
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  h1,
  h2 {
    font-weight: normal;
  }

  ul {
    list-style-type: none;
    padding: 0;
  }

  li {
    display: inline-block;
    margin: 0 10px;
  }

  a {
    color: #42b983;
  }
</style>
